Skip to content

Conversation

@ddavis-2015
Copy link
Member

@tensorflow/micro

Add support for application custom DECODE operator registrations.
Additional unit tests.

bug=fixes #3215

@tensorflow/micro

Add support for alternate decompression memory to DECODE operator.
Additional unit tests.
Update generic benchmark application and Makefile.

bug=fixes tensorflow#3212
@tensorflow/micro

Add support for application custom DECODE operator registrations.
Additional unit tests.

bug=fixes tensorflow#3215
@ddavis-2015 ddavis-2015 marked this pull request as ready for review November 20, 2025 02:36
@ddavis-2015 ddavis-2015 requested a review from a team as a code owner November 20, 2025 02:36
@ddavis-2015 ddavis-2015 requested a review from veblush November 20, 2025 03:08
Copy link
Collaborator

@veblush veblush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

// Set the custom DECODE operator registrations.
// Can only be called during the kInit state.
virtual TfLiteStatus SetCustomDecodeRegistrations(
const std::initializer_list<CustomDecodeRegistration>& registrations) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetCustomDecodeRegistrations could pose a lifetime safety issue. Storing a pointer to a std::initializer_list is dangerous because the underlying array is often a temporary object that gets destroyed immediately after the function returns. Please update the API to accept a pointer to a persistent array and a size count (e.g., const CustomDecodeRegistration* registrations, size_t size) so the caller is explicitly responsible for ensuring the data's lifetime matches that of the interpreter. (also its comment should mention about the lifetime expectation)

With this change, this kind of help function would be helpful .

template <size_t N>
TfLiteStatus SetCustomDecodeRegistrations(const CustomDecodeRegistration (&regs)[N]) {
  return SetCustomDecodeRegistrations(regs, N);
}

We might want to make a similar change to decompress_regions_ as well but it could be a separate PR.

uint8_t reserved1; // reserved
uint8_t reserved2; // reserved
uint8_t reserved3; // reserved
tflite::DecodeState* (*func)(const TfLiteContext*, MicroProfilerInterface*);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of func, factory or create_state would be better to describes what the function will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for DECODE operator

3 participants